package com.itheima.thread;
/*
守护线程
 */
public class Demo08 {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("线程1执行到了" + i);
            }
        });
        //thread.setDaemon(true);
        thread.start();
        Thread thread2 = new Thread(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("线程2执行到了" + i);
            }
        });
        //thread2.setDaemon(true);
        thread2.start();
        for (int i = 0; i < 10; i++) {
            System.out.println("main线程 执行到了" + i);
        }
    }

}
